
const strategies = {
    pow: function (data) {
        return data * data
    },
    abs: function (data) {
        return data < 0 ? -data : data
    },
    sqrt: function (data) {
        return Math.sqrt(data)
    }
}

function runStrategy(strategy, data) {
    if (strategies.hasOwnProperty(strategy)) {
        return strategies[strategy](data);
    } else {
        throw new Error('Invalid strategy');
    }
}
